#include "SQLtable.h"

#include "../RealObject/Phone.h"

class CPhoneTable : public CSqlTable
{
public:
	CPhoneTable();
	static int  getMaxCode();
	static bool checkIMEI(CString sIMEI, CPhone* &pPhone);
	static CPhone* getPhoneAtStoreByImei(CString sIMEI, CString sCodeStore);
	static CPhone* getPhoneAtStoreByCode(CString sCodePhone, CString sCodeStore);
	static bool updateTable(const CPhone* pPhone);
	static bool CPhoneTable::updateTransfer(const CPhone* pPhone);

	static bool InsertPhone(const CPhone* pPhone);
	static bool deleteRecord(CString sIMEI);

	static bool buyPhone(CString sCodePhone);

	static vector<CPhone*>  getListPhone(const CString& sCodeProduct);
	static vector<CPhone*>  getListPhoneByStore(const CString& sCodeProduct, const CString& sCodeStore);
	static CPhone*  getPhoneByCode(const CString& sCode);
	static int getCountPhone(const CString& sCodeProduct);
	static int getCountPhoneInStore(const CString& sCodeProduct,const CString& sCodeStore);	
	static vector<CPhone*>  getListPhoneInBill(const CString& sCodeBill);

	static bool getTypePhoneRemain(const CString& sCodeStore,vector<CString>& vtCodeProduct, vector<int>&vtCount);

};